import Muntil from 'until/mm.jsx'

const _mm=new Muntil();

class Product {

    //获取商品列表
    getProduceList(listParm){
        let url='',
            data={};
        if(listParm.listType==='list'){
            url = "/manage/product/list.do"
            data.pageNum = listParm.pageNum
        }else if(listParm.listType==='search'){
            url= "/manage/product/search.do"
            data.pageNum = listParm.pageNum
            data[listParm.searchType] = listParm.keyword

        }


        return _mm.request({
            type:'post',
            url:url,
            data:data
        })
    }

    //变更商品上下架
    setProductStatus(productInfo){
        return _mm.request({
            type:'post',
            url:"/manage/product/set_sale_status.do",
            data:productInfo

        })
    }

    //获取品类列表
    getCatetgoryList(categoryId){
        return _mm.request({
            type:'post',
            url:"/manage/category/get_category.do",
            data:{
                categoryId:categoryId ||0
            }

        })
    }

    updataCategoryName(categoryinfo){
        return _mm.request({
            type:'post',
            url:"/manage/category/set_category_name.do",
            data:categoryinfo

        })
    }

    saveCategory(categoryinfo){
        return _mm.request({
            type:'post',
            url:"/manage/category/add_category.do",
            data:categoryinfo

        })
    }



}

export default Product;